#pragma once

#include <iostream>
#include <functional>
#include <unistd.h>
#include <string>
#include <cstring>
#include <cstdlib>
#include <memory>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

// 设置常量, 统一规划错误码
enum ExitCode
{
    OK = 0,
    USAGE_ERR, // 使用错误
    SOCKET_ERR, // 套接字创建错误
    BIND_ERR, // 绑定失败
    LISTEN_ERR, // 监听失败
    CONNECT_ERR,
    FORK_ERR
};

class NoCopy
{
private:

public:
    NoCopy(){}
    // 拷贝构造和赋值语句都被delete了
    NoCopy(const NoCopy &) = delete;
    const NoCopy &operator = (const NoCopy &) = delete; 
    virtual ~NoCopy() = default;
};

#define CONV(addr) ((struct sockaddr*)&addr) // 宏定义强转函数